<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="author" content="甘忠祥">
    <title>人物变换</title>
    <style>
        *{
            box-sizing: border-box;
        }
        ul,li{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        .container{
            width: 500px;
            margin: 0 auto;
        }
        .content{
            width: 500px;
            height: 600px;
            border: 2px solid black;
            
        }
        .show{
            width: 358px;
            height: 340px;
            border: 1px solid black;
            border-radius: 15px;
            float: left;
            margin: 5px;
        } 
        .show img{
            width: 358px;
            height: 340px;
        }
        img{
            width: 113px;
            height: 105px;
            border-radius: 15px;
        }
        .content li{
            float: left;
            margin: 5px;
        }
        .img-list img:hover{
            box-shadow: 0 0 5px black;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="content">
            <div class="show">
                 <img src="img/12.jpg" alt=""> 
            </div>
             <ul class="img-list">
                <li><img src="img/1.jpg" alt=""></li>
                <li><img src="img/2.jpg" alt=""></li>
                <li><img src="img/3.jpg" alt=""></li>
                <li><img src="img/4.jpg" alt=""></li>
                <li><img src="img/5.jpg" alt=""></li>
                <li><img src="img/6.jpg" alt=""></li>
                <li><img src="img/7.jpg" alt=""></li>
                <li><img src="img/8.jpg" alt=""></li>
                <li><img src="img/9.jpg" alt=""></li>
                <li><img src="img/10.jpg" alt=""></li>
                <li><img src="img/11.jpg" alt=""></li>
            </ul> 
        </div>
    </div>
</body>
<script>
        var imgLis = document.querySelector('.img-list').querySelectorAll('img');
        var show = document.querySelector('.show').querySelector('img');
        var index = 0;
        for(var i = 0; i < imgLis.length; i++){
            imgLis[i].index = i;
            imgLis[i].onmousemove = function(){
                show.src = imgLis[this.index].src;
            }
        }
</script>
</html> 